]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
systemActions: Fix initial visibility of logout action
authorSebastian Keller <skeller@gnome.org>
Fri, 13 Mar 2026 00:27:29 +0000 (01:27 +0100)
committerMarge Bot <marge-bot@gnome.org>
Sat, 14 Mar 2026 10:23:12 +0000 (10:23 +0000)
When `_updateLogout()` is called on login, the AccountsService user
might not have been loaded yet. This would have resulted in all values
being null/false, including `local_account`. Since `!localAccount` is
one of the cases where the action is available, this would have wrongly
resulted in the item being shown when not intended to be shown. But only
until something triggers another call of `_updateLogout()`, such as
locking/unlocking the session.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9100
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4121>

js/misc/systemActions.js

index db559bfc2ba1f902c2f4489f8686d28ce26a2d51..75bada6a17b294a29c6bf632d6c2ba2ed73d480d 100644 (file)
@@ -176,6 +176,10 @@ const SystemActions = GObject.registerClass({
         this._userManager.connect('user-removed',
             () => this._updateMultiUser());
 
+        this._user = this._userManager.get_user(GLib.get_user_name());
+
+        this._user.connect('notify::is-loaded', () => this._updateLogout());
+
         this._lockdownSettings.connect(`changed::${DISABLE_USER_SWITCH_KEY}`,
             () => this._updateSwitchUser());
         this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`,
@@ -434,12 +438,9 @@ const SystemActions = GObject.registerClass({
     }
 
     _updateLogout() {
-        const user = this._userManager.get_user(GLib.get_user_name());
-
         const allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
         const alwaysShow = global.settings.get_boolean(ALWAYS_SHOW_LOG_OUT_KEY);
-        const systemAccount = user.system_account;
-        const localAccount = user.local_account;
+        const {systemAccount, localAccount} = this._user;
         const multiUser = this._userManager.has_multiple_users;
         const multiSession = Gdm.get_session_ids().length > 1;
         const shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;